package com.briup.recognition.web.controller;

import com.briup.recognition.bean.Interface;
import com.briup.recognition.service.IInterfaceService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: ldd
 * @Date: 2021/03/28/21:17
 * @Description:
 */
@RestController
@RequestMapping("/interfaces")

public class InterfaceController {
    @Autowired
    private IInterfaceService interfaceService;

    @GetMapping("query")
    public Message query(){
        List<Interface> list = interfaceService.query();
        return MessageUtil.success(list);

    }

    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(Interface interfaces){
        interfaceService.saveOrUpdate(interfaces);
        return MessageUtil.success("success");
    }

    @DeleteMapping("deleteById")
    public Message deleteById(long id){
        interfaceService.deleteById(id);
        return MessageUtil.success("success");
    }
}
